﻿using System;
using System.Collections.Generic;
using System.Text;

namespace StationUpdate
{
    public class BCDConvert
    {
        public static char convertCharToInt(char ch)
        {
            UInt16 ntemp = 0;
            try
            {
                if ((ch >= '0') && (ch <= '9'))
                {
                    ntemp = (UInt16)((UInt16)ch - 48);
                    return (char)ntemp;
                }
                if ((ch >= 'A') && (ch <= 'F'))
                {
                    ntemp = (UInt16)((UInt16)ch - 65 + 10);
                    return (char)ntemp;
                }
                if ((ch >= 'a') && (ch <= 'f'))
                {
                    ntemp = (UInt16)((UInt16)ch - 97 + 10);
                    return (char)ntemp;
                }
            }
            catch (Exception ex)
            {
            }
            return (char)ntemp;
        }
    }
}
